#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>

#define FOR(i,a,n) for(int i=a,_n(n);i<_n;++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int dir[][6]={
        {0,1,2,3,4,5},
        {1,0,4,3,2,5},
        {2,4,1,3,0,5},
        {3,5,1,4,0,2},
        {4,2,0,3,1,5},
        {5,3,0,4,1,2}
};
int main()
{
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    set<string> exist;
    int ans = 0;
    do
    {
        if(exist.count(s)) continue;
        REP(i,6)
        {
            REP(j,4)
            {
                string st;
                st += s[dir[i][0]];
                st += s[dir[i][1]];
                REP(k,4) st+=s[dir[i][(k+j)%4+2]];
                exist.insert(st);
            }
        }
        ans++;
    }while(next_permutation(s.begin(),s.end()));
    printf("%d\n",ans);
	return 0;
}
